#ifndef _RESTART_INFO_H_
#define _RESTART_INFO_H_

#include "stdint.h"

typedef enum {
    RT_POWER_ON                             = 0,                                    // 正常上电
    RT_SOFT_RESET,
    RT_WATCH_DOG
} restart_type_t;

typedef enum {
    SR_NONE                                 = 0,                                    // 无
    SR_SEV_INIT_ERR,
    SR_SERVER_CMD,
    SR_UPDATE_CMD,
    SR_NETWORK_ERR,
    SR_SERVER_ERR,
    SR_DEVICE_PLAN,
} softre_reason_t;

typedef struct restart_information
{
    restart_type_t  restart_type;           // 复位寄存器重启类型（务必与表对应）
    softre_reason_t softre_reason;          // 软件重启原因（务必与表对应）
    uint8_t net_err_reason;                 // 最后一次网络错误原因
    uint8_t wd_error_round;                 // APP持续错误重启次数
    uint8_t nw_error_round;                 // 网络持续错误重启次数
}restart_info_t;

extern restart_info_t restart_info;
extern const char* restart_type_table[];
extern const char* softre_reason_table[];

void Restart_Info_Save_Bpr(void);
void Restart_Info_Read_Bpr(void);

#endif
